package cn.lentme.demo.fragments.blank

import androidx.lifecycle.Observer
import cn.lentme.demo.databinding.FragmentBlankBinding
import cn.lentme.demo.entity.HitokotoData
import cn.lentme.demo.request.viewmodel.BlankViewModel
import cn.lentme.demo.base.BaseFragment
import org.koin.androidx.viewmodel.ext.android.getViewModel

class BlankFragment: BaseFragment<FragmentBlankBinding, BlankViewModel>() {

    override fun fetchBinding() = FragmentBlankBinding.inflate(layoutInflater)
    override fun fetchViewModel(): BlankViewModel = getViewModel()

    private val observer = Observer<HitokotoData>(){
        mBinding.blankTv.text = it.hitokoto
    }

    override fun initData() {
        super.initData()
        mViewModel.fetchHitokotoData().observe(this, observer)
    }

}